package com.feri.redromance01.controller;

import com.feri.redromance01.entity.Admin;
import com.feri.redromance01.service.intf.AdminService;
import com.feri.redromance01.vo.PageBean;
import com.feri.redromance01.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName lcf
 * @Description TODO
 * @Author ASDFGH
 * @Date 2022/8/31 11:09
 * @Version 1.0
 */
@RestController
@RequestMapping("/api/admin/")
public class AdminController {

    @Autowired
    private AdminService service;

    /**
     * 新增
     */
    @PostMapping("save.do")
    public R save(Admin admin){
        return service.save(admin);
    }


    /**
     * 修改
     */
    @PostMapping("update.do")
    public R update(Admin admin){
        return service.update(admin);
    }


    /**
     * 删除
     */
    @GetMapping("del.do")
    public R del(int id){
        return service.delete(id);
    }

    /**
     * 查询
     */
    @GetMapping("page.do")
   public PageBean page(String admin_act,int page,int limit){
       return service.selectPage(admin_act, page, limit);
   }
}
